<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport"
  content="width=device-width, initial-scale=1.0, minimum-scale=1,maximum-scale=1,user-scalable=no">
 <meta http-equiv="X-UA-Compatible" content="ie=edge">
 <title data-ch="恐龙探险" data-en="Dinosaur Adventure" class="document_title">恐龙探险</title>
 <script src="js/jquery-3.3.1.min.js"></script>
 <script src="js/common.js"></script>
 <script src="js/rem.js"></script>
 <script src="js/layer.js"></script>
 <script type="text/javascript">
  isLogin();
 </script>
 <link rel="stylesheet" href="css/common.css">
 <link rel="stylesheet" type="text/css" href="css/css.css">
</head>
<body>
<!--头部-->
<div class="jui_top_bar">
    <a class="jui_top_left" href="javascript:history.back(-1)"><img src="icons/back.png"></a>
    <div class="jui_top_middle" data-ch="实名认证" data-en="KYC Verification">实名认证</div>
</div>
<!--头部end--> 
<!--主体-->
<form action="">
<div class="jui_main" id="rz_details">
     <!-- 实名认证提交 -->
     
     <!-- 实名认证提交end -->

     <!-- 已实名 -->
     
     <!-- 已实名 -->
</div>
</form>
<!--主体end-->

<script>
 $(function(){
  var language_type = localStorage.getItem("language_type");
  var isRenzheng;
  // 实时获取实名认证情况
  var data1 = {
   uid: localStorage.getItem("u_id"),
   token: localStorage.getItem("token"),
   language_type: localStorage.getItem("language_type"),
  }
  $.ajax({
   type: 'post',
   url: baseURL + '/index.php?m=user&c=config_setup',
   data: data1,
   success: function success(data) {
    data = JSON.parse(data);
	is_login(data);
    if (data.code == 1) {
     isRenzheng = data.is_check;// 是否实名认证 0-没有 1-有 2-待审核
     var details = ''; // 定义文本内容
     var canClick = true; // 定义是否可以重复点击
     if(isRenzheng == 0){
      // 如果没有实名认证
      details = `<div class="jui_pad_12">
       <div class="bg_light_black jui_bor_rad_15 jui_pad_20">
        <div class="col_fff jui_pad_b5" data-ch="全名" data-en="Full name">全名</div>
        <input id="rz_name" class="jui_bor_rad_5 smrz_input" type="text" value="" data-ch="全名" data-en="Full Name"
         placeholder="全名">
        <div class="jui_h16"></div>
        <div class="col_fff jui_pad_b5" data-ch="身份证号码" data-en=" IC No.">身份证号码</div>
        <input id="rz_num" class="jui_bor_rad_5 smrz_input" type="text" value="" data-ch="身份证号码" data-en="IC No."
         placeholder="身份证号码">
        <div class="jui_h20"></div>
        <div class="jui_text_center col_fff f24" data-ch="实名认证和银行户口名称必须一致"
         data-en="KYC and Bank details must be the same">
         实名认证和银行户口名称必须一致</div>
        <div class="jui_h20"></div>
        <div id="rz_btn" class="smrz_btn" data-ch="确认" data-en="Confirm ">确认</div>
        <div class="jui_h12"></div>
       </div>
      </div>`
     } else if(isRenzheng == 1) { // 如果已经实名认证
      details = `<div class="jui_pad_12">
       <div class="bg_light_black jui_bor_rad_15 jui_pad_20">
        <div class="col_fff jui_pad_b5 jui_text_center" data-ch="您的实名已确认！"
         data-en="Your KYC has been verified">
         您的实名已确认！</div>
        <div class="jui_h20"></div>
        <a class="smrz_btn" href="my_konglong.html" data-ch="返回" data-en="Back">返回</a>
        <div class="jui_h12"></div>
       </div>
      </div>`
     } else {
      details = `<div class="jui_pad_12">
       <div class="bg_light_black jui_bor_rad_15 jui_pad_20">
        <div class="col_fff jui_pad_b5 jui_text_center" data-ch="实名认证审核中,请耐心等待" data-en="Please wait patiently for real-name certification review">
         实名认证审核中,请耐心等待</div>
        <div class="jui_h20"></div>
        <a class="smrz_btn" href="my_konglong.html" data-ch="返回" data-en="Back">返回</a>
        <div class="jui_h12"></div>
       </div>
      </div>`
     }
     $("#rz_details").html(details)
     language()

     $("#rz_btn").click(function(){
      if(canClick == true){
       var userName = $("#rz_name").val();
       var userPass = $("#rz_num").val();
       if(!userName){
        box_timer(language_type == 1 ? '请输入名字' : 'Please enter your name');
       } else if(!/^\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{6}$/.test(userPass)){
        box_timer(language_type == 1 ? '请输入正确的身份证号' : 'Please enter the correct IC number');
       } else {
        let data = {
         uid: localStorage.getItem("u_id"),
         token: localStorage.getItem("token"),
         language_type: localStorage.getItem("language_type"),
         card_name: userName,
         card_id: userPass
        }
        $.ajax({
         type: 'post',
         url: baseURL + '/index.php?m=user&c=real_name',
         data: data,
         success: function success(data) {
          data = JSON.parse(data);
    	  is_login(data);
          box_timer(data.msg);
          if(data.code == 1){
           canClick = false;
           setTimeout(function(){
            window.history.go(-1) // 返回上一页
           },1500)
          }
         }
        })
       }
      } else {
       box_timer(language_type == 1 ? '您已提交,请耐心等待审核哦' : 'Your request is being submitted , please be patient while we are processing');
      }
     })
    }
   }
  })

  
  

  language();
  documentName()
 })
</script>
</body>
</html>